// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) definits fieldsfirst ansi space safe 
// Source File Name:   SensorPanel.java

package jones.gui;

import java.awt.*;
import java.util.Observer;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import jones.SimpleRobot;

// Referenced classes of package jones.gui:
//            PhotoSensorView, EncoderView, IRSensorView, BumpSensorView, 
//            PushSensorView, BehaviorView

public class SensorPanel extends JPanel
{

    private SimpleRobot robot = null;

    public SensorPanel()
    {
        robot = null;
        init();
    }

    public SensorPanel(SimpleRobot robot)
    {
        this.robot = null;
        this.robot = robot;
        init();
    }

    private void init()
    {
        setLayout(((java.awt.LayoutManager) (new GridLayout(6, 1))));
        addWithLabel(((Component) (new PhotoSensorView())), "Photo:");
        addWithLabel(((Component) (new EncoderView())), "Encoders:");
        addWithLabel(((Component) (new IRSensorView())), "IR:");
        addWithLabel(((Component) (new BumpSensorView())), "Bump:");
        addWithLabel(((Component) (new PushSensorView())), "Push:");
        addWithLabel(((Component) (new BehaviorView())), "Behavior:");
    }

    private void addWithLabel(Component c, String s)
    {
        JPanel panel = new JPanel(((java.awt.LayoutManager) (new BorderLayout())));
        JLabel label = new JLabel(s);
        javax.swing.border.Border border = ((javax.swing.border.Border) (new EmptyBorder(5, 5, 5, 5)));
        label.setBorder(border);
        panel.add(((Component) (label)), "North");
        panel.add(c, "Center");
        add(((Component) (panel)));
        if (robot != null && (c instanceof Observer))
            robot.addObserver((Observer)c);
    }
}
